package Model
{
	import Model.Topic;
	
	import mx.collections.ArrayCollection;

	[Bindable]
	public class DateGroup
	{
		protected var _TopicDate:Date;
		protected var _Topics:ArrayCollection;
		
		public function DateGroup(date:Date, topics:ArrayCollection)
		{
			_TopicDate = date;
			_Topics = new ArrayCollection(topics.source);
		}
		
		public function get TopicDate():Date
		{
			return _TopicDate;
		}
		
		public function get Topics():ArrayCollection
		{
			return _Topics;
		}
		
		
		
		public function addTopic(topic:Topic):void
		{
			_Topics.addItem(topic);
		}
		
		
		public function getWeekDay(day1:Number):String
		{
			var day:String;
			switch(day1)
			{
				case 1: day = "Monday"; break;
				case 2: day = "Tuesday"; break;
				case 3: day = "Wednesday"; break;
				case 4: day = "Thursday"; break;
				case 5: day = "Friday"; break;
				case 6: day = "Saturday"; break;
				case 0: day = "Sunday"; break;
			}
			return day;
		}
		
		public function getMonths(month1:Number):String
		{
			var month:String
			switch(month1)
			{
				case 0: month = "January"; break;
				case 1: month = "Febraury"; break;
				case 2: month = "March"; break;
				case 3: month = "April"; break;
				case 4: month = "May"; break;
				case 5: month = "June"; break;
				case 6: month = "July"; break;
				case 7: month = "August"; break;
				case 8: month = "September"; break;
				case 9: month = "October"; break;
				case 10: month = "November"; break;
				case 11: month = "December"; break;
			}
			return month;
		}
		
		
		
		public function TopicDateString():String
		{
			var topicDate:String =  getWeekDay(_TopicDate.getDay()) + " " + 
				_TopicDate.getDate().toString() + " " +  getMonths(_TopicDate.getMonth()) + " " + 
				_TopicDate.getFullYear().toString();
			return topicDate;	
		}
		
	}
}